﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Common;
using LLFM.CAT.Service;
using LLFM.CAT.Model;

public partial class Admin_Product_ProductImagList : AdminPage
{
    public int productId { get { return RequestHelper.GetInt("productId",0);} }
    public int seq = 0;
    protected void Page_Load(object sender, EventArgs e)
    {
        List<M_ProductsImages> imgs = ProductsImagesService.GetProductImagesListByProductId(productId, 1);
        int num = imgs.Count;
        if(num > 0)
        {
            seq = imgs[num - 1].Sequence;
        }
        imgRepeater.DataSource = imgs;
        imgRepeater.DataBind();
    }

    protected void ImgItemCommand(object sender, RepeaterCommandEventArgs e)
    {
        if (e.CommandName == "delete")
        {
            int imgId = Common.TypeParse.StrToInt(e.CommandArgument, 0);
            ProductsImagesService.DelProductsImagById(imgId);
            Response.Redirect("ProductImagList.aspx?productId=" + productId);
        }
    }
}